﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeChatCardProxy.WebApiEntity;


namespace ZilLion.Service.WeChatCardProxy.Domain
{
    public class Access_tokenRepository : ZilLion.Service.Core.DapperWrapper.Respository<Access_token>, IAccess_tokenRepository
    {

        public Access_tokenRepository()
        {
            Context = new WeChatCardProxyContext();
        }

        public void InsertAccess_token(Access_token token)
        {
            this.Add(token);
        }

        public void UpdateAccess_token(Access_token token)
        {
            this.Modify(token);
        }

        public Access_token GetAccess_token(Access_token token)
        {
            var item = this.GetList("select * from Component_access_token where component_appid=@component_appid", new { token.component_appid }).FirstOrDefault();
            return item;
        }

        public List<Access_token> GetAccess_token()
        {
            var items = this.GetList("select * from Component_access_token");
            return items.ToList();
        }


    }
}
